<template>
  <div>
    <el-button @click="InsertProcess">新增工序</el-button>
  <el-table :data="ProcessData" style="width: 100%">
    <el-table-column prop="processId" label="序号" width="60" />
    <el-table-column prop="processNum" label="工序编码" width="130" />
    <el-table-column prop="processName" label="工序名称" width="130" />
    <el-table-column prop="workCentre" label="工作中心" width="130" />
    <el-table-column prop="handleTime" label="创建时间" width="150" />
    <el-table-column prop="handle" label="创建人" width="150" />
    <el-table-column prop="processState" label="状态" width="150">
      <template v-slot="scope">
        <el-tag v-if="scope.row.processState==false" type="primary" effect="plain">有效</el-tag>
        <el-tag v-if="scope.row.processState==true" type="danger" effect="plain">无效</el-tag>
      </template>
    </el-table-column>
    <el-table-column prop="processAudit" label="审批状态" width="130" >
      <template v-slot="scope">
        <el-tag v-if="scope.row.processAudit==0" type="primary" effect="plain">未提交</el-tag>
        <el-tag v-if="scope.row.processAudit==1" type="danger" effect="plain">已提交</el-tag>
        <el-tag v-if="scope.row.processAudit==2" type="warning" effect="plain">已驳回</el-tag>
      </template>
    </el-table-column>
    <el-table-column label="操作" width="180" >
      <el-button>编辑</el-button>
      <el-button>删除</el-button>
    </el-table-column>
  </el-table>
  </div>
</template>
  
<script lang="ts" setup>
import {ref,onMounted} from 'vue';
const apiUri=import.meta.env.VITE_APP_API_URL_WAREHOUSE;
import axios from 'axios';
import {useRouter } from 'vue-router';
const router=useRouter();

onMounted(()=>{
  GetProcessData();
})

const ProcessData=ref([]);
const GetProcessData=()=>{
  axios.get(apiUri+"/api/Process/ShowProcessData").then(res=>{
    ProcessData.value=res.data.data;
  })
}

const InsertProcess=()=>{
  router.push('/AddProcessData');
}


</script>